package com.oa.co.listener;



import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import com.oa.co.bo.Reissue_cardBo;

import com.oa.co.pojo.Reissue_card;
import com.oa.co.service.RepairService;
;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Scope("prototype")
public class WebRepairListener extends AnalysisEventListener<Reissue_cardBo> {

    @Autowired
    RepairService repairService;


    @Override
    public void invoke(Reissue_cardBo reissue_cardBo, AnalysisContext analysisContext) {
        Reissue_card reissue_card = new Reissue_card();
        reissue_card.setD_id("BK-"+System.currentTimeMillis());
        reissue_card.setCreation_time(new Date());
        BeanUtils.copyProperties(reissue_cardBo,reissue_card);
        repairService.repairAdd(reissue_card);

    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
